In [ ]:
import pandas as pd
import numpy as np
In [ ]:
df = pd.read_csv("./data_cleaned.csv")
df.head()
In [ ]:
df["Sales ID"] = df.index + 1
df.head()
In [ ]:
df.pivot_table(index="Sales Person")
In [ ]:
df.groupby("Sales Person").sum()
In [ ]:
df.pivot_table(index=["Sales Person", "Order Date"])
In [ ]:
df_quarter = pd.read_csv("./data_quarter.csv")
df_quarter
In [ ]:
df = df.merge(df_quarter, on="Sales ID")
df
In [ ]:
df["Sales Person"].unique()
In [ ]:
pd.unique([1, 1, 2, 3, 7, 9, 2, 1])
In [ ]:
df.query("Quarter == 4")
In [ ]:
df[df.Quarter == 4]
In [ ]:
columns = df.columns.map(lambda col: col.replace(' ', '_'))
df.columns = columns
df
In [ ]:
df.query('Items_Sold > 1 and Quarter == 2')
In [ ]:
df.query("(Sales_Person == 'John' or Sales_Person == 'Mary') and Item_Price > 5")